Rules for integrands of the form (((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))

1:  ∫(((b Sin[e+f x]))^m) (B Sin[e+f x]+C ((Sin[e+f x])^2))dx

Derivation: Algebraic simplification

Rule:

∫(((b Sin[e+f x]))^m) (B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  (1/b) ∫(((b Sin[e+f x]))^(m+1)) (B+C Sin[e+f x])dx

Program code:

Int[(b_.*sin[e_.+f_.*x_])^m_.*(B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  1/b*Int[(b*Sin[e+f*x])^(m+1)*(B+C*Sin[e+f*x]),x] /;
FreeQ[{b,e,f,B,C,m},x]

2.  ∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx

1:  ∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  when  A (m+2)+C(m+1)==0

Derivation: Nondegenerate sine recurrence 1a with n->0,p->0

Rule: If  A (m+2)+C(m+1)==0, then

∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  ⟶  ((A Cos[e+f x](((b Sin[e+f x]))^(m+1)))/(b f (m+1)))

Program code:

Int[(b_.*sin[e_.+f_.*x_])^m_.*(A_+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  A*Cos[e+f*x]*(b*Sin[e+f*x])^(m+1)/(b*f*(m+1)) /;
FreeQ[{b,e,f,A,C,m},x] && EqQ[A*(m+2)+C*(m+1),0]

2:  ∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  when  m<-1

Derivation: Nondegenerate sine recurrence 1a with n->0,p->0

Rule: If  m<-1, then

∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  ⟶  
((A Cos[e+f x](((b Sin[e+f x]))^(m+1)))/(b f (m+1)))+((A (m+2)+C(m+1))/((b^2) (m+1)))∫(((b Sin[e+f x]))^(m+2))dx

Program code:

Int[(b_.*sin[e_.+f_.*x_])^m_*(A_+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  A*Cos[e+f*x]*(b*Sin[e+f*x])^(m+1)/(b*f*(m+1)) + (A*(m+2)+C*(m+1))/(b^2*(m+1))*Int[(b*Sin[e+f*x])^(m+2),x] /;
FreeQ[{b,e,f,A,C},x] && LtQ[m,-1]

3.  ∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  when  m≮-1

1:  ∫((Sin[e+f x])^m) (A+C ((Sin[e+f x])^2))dx  when  ((m+1)/2)∈(SuperPlus[ℤ])

Derivation: Algebraic expansion and integration by substitution

Basis: ((Sin[z])^2)==1-((Cos[z])^2)

Basis: If ((m+1)/2)∈ℤ, then ((Sin[e+f x])^m)==-(1/f) Subst[(((1-(x^2)))^((m-1)/2)),x,Cos[e+f x]] (∂_x)Cos[e+f x]

Rule: If ((m+1)/2)∈(SuperPlus[ℤ]), then

∫((Sin[e+f x])^m) (A+C ((Sin[e+f x])^2))dx  ⟶  ∫((Sin[e+f x])^m) (A+C-C ((Cos[e+f x])^2))dx
  ⟶  -(1/f) Subst[∫(((1-(x^2)))^((m-1)/2)) (A+C-C (x^2))dx,x,Cos[e+f x]]

Program code:

Int[sin[e_.+f_.*x_]^m_.*(A_+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -1/f*Subst[Int[(1-x^2)^((m-1)/2)*(A+C-C*x^2),x],x,Cos[e+f*x]] /;
FreeQ[{e,f,A,C},x] && IGtQ[(m+1)/2,0]

2:  ∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  when  m≮-1

Derivation: Nondegenerate sine recurrence 1b with m->0,p->0

Rule: If  m≮-1, then

∫(((b Sin[e+f x]))^m)(A+C ((Sin[e+f x])^2))dx  ⟶  
-((C Cos[e+f x](((b Sin[e+f x]))^(m+1)))/(b f (m+2)))+((A (m+2)+C(m+1))/(m+2))∫(((b Sin[e+f x]))^m)dx

Program code:

Int[(b_.*sin[e_.+f_.*x_])^m_.*(A_+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -C*Cos[e+f*x]*(b*Sin[e+f*x])^(m+1)/(b*f*(m+2)) + (A*(m+2)+C*(m+1))/(m+2)*Int[(b*Sin[e+f*x])^m,x] /;
FreeQ[{b,e,f,A,C,m},x] && Not[LtQ[m,-1]]

3:  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  A (b^2)-a b B+(a^2) C==0

Derivation: Algebraic simplification

Basis:  If  A (b^2)-a b B+(a^2) C==0, then A+B z+C (z^2)==(1/(b^2))(a+b z)(b B-a C+b C z)

Rule: If  (a^2)-(b^2)≠0 ∧ A (b^2)-a b B+(a^2) C==0, then

∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  (1/(b^2)) ∫(((a+b Sin[e+f x]))^(m+1))(b B-a C+b C Sin[e+f x])dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_.*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  1/b^2*Int[(a+b*Sin[e+f*x])^(m+1)*Simp[b*B-a*C+b*C*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,B,C,m},x] && EqQ[A*b^2-a*b*B+a^2*C,0]

Int[(a_+b_.*sin[e_.+f_.*x_])^m_.*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  C/b^2*Int[(a+b*Sin[e+f*x])^(m+1)*Simp[-a+b*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,C,m},x] && EqQ[A*b^2+a^2*C,0]

4:  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  A-B+C==0 ∧ 2 m∉ℤ

Derivation: Algebraic expansion

Basis: If  A-B+C==0, then A+B z+C (z^2)==(A-C) (1+z)+C (((1+z))^2)

Rule: If  A-B+C==0 ∧ 2 m∉ℤ, then

∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  
(A-C) ∫(((a+b Sin[e+f x]))^m)(1+Sin[e+f x])dx+C ∫(((a+b Sin[e+f x]))^m)(((1+Sin[e+f x]))^2)dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_.*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  (A-C)*Int[(a+b*Sin[e+f*x])^m*(1+Sin[e+f*x]),x] + C*Int[(a+b*Sin[e+f*x])^m*(1+Sin[e+f*x])^2,x] /;
FreeQ[{a,b,e,f,A,B,C,m},x] && EqQ[A-B+C,0] && Not[IntegerQ[2*m]]

Int[(a_+b_.*sin[e_.+f_.*x_])^m_.*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  (A-C)*Int[(a+b*Sin[e+f*x])^m*(1+Sin[e+f*x]),x] + C*Int[(a+b*Sin[e+f*x])^m*(1+Sin[e+f*x])^2,x] /;
FreeQ[{a,b,e,f,A,C,m},x] && EqQ[A+C,0] && Not[IntegerQ[2*m]]

5.  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  m<-1

1:  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  m<-1 ∧ (a^2)-(b^2)==0

Derivation: Symmetric sine recurrence 2a with m->0 plus rule for integrands of the form ((Sin[e+f x])^2)(((a+b Sin[e+f x]))^m)

Rule: If  m<-1 ∧ (a^2)-(b^2)==0, then

∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  
∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x])dx+C∫((Sin[e+f x])^2)(((a+b Sin[e+f x]))^m)dx   ⟶  
(((A b-a B+b C) Cos[e+f x](((a+b Sin[e+f x]))^m))/(a f (2m+1)))+
(1/((a^2)(2m+1)))∫(((a+b Sin[e+f x]))^(m+1))(a A(m+1)+m(b B-a C)+b C (2m+1)Sin[e+f x])dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  (A*b-a*B+b*C)*Cos[e+f*x]*(a+b*Sin[e+f*x])^m/(a*f*(2*m+1)) + 
  1/(a^2*(2*m+1))*Int[(a+b*Sin[e+f*x])^(m+1)*Simp[a*A*(m+1)+m*(b*B-a*C)+b*C*(2*m+1)*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,B,C},x] && LtQ[m,-1] && EqQ[a^2-b^2,0]

Int[(a_+b_.*sin[e_.+f_.*x_])^m_*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  b*(A+C)*Cos[e+f*x]*(a+b*Sin[e+f*x])^m/(a*f*(2*m+1)) + 
  1/(a^2*(2*m+1))*Int[(a+b*Sin[e+f*x])^(m+1)*Simp[a*A*(m+1)-a*C*m+b*C*(2*m+1)*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,C},x] && LtQ[m,-1] && EqQ[a^2-b^2,0]

2:  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  m<-1 ∧ (a^2)-(b^2)≠0

Derivation: Nondegenerate sine recurrence 1a with n->0,p->0

Rule: If  m<-1 ∧ (a^2)-(b^2)≠0, then

∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  
-(((A (b^2)-a b B+(a^2) C) Cos[e+f x](((a+b Sin[e+f x]))^(m+1)))/(b f (m+1) ((a^2)-(b^2))))+
(1/(b(m+1)((a^2)-(b^2))))∫(((a+b Sin[e+f x]))^(m+1))(b(a A-b B+a C)(m+1)-(A (b^2)-a b B+(a^2) C+b (A b-a B+b C) (m+1))Sin[e+f x])dx

Program code:

Int[(a_.+b_.*sin[e_.+f_.*x_])^m_*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -(A*b^2-a*b*B+a^2*C)*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*(m+1)*(a^2-b^2)) + 
  1/(b*(m+1)*(a^2-b^2))*
    Int[(a+b*Sin[e+f*x])^(m+1)*Simp[b*(a*A-b*B+a*C)*(m+1)-(A*b^2-a*b*B+a^2*C+b*(A*b-a*B+b*C)*(m+1))*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,B,C},x] && LtQ[m,-1] && NeQ[a^2-b^2,0]

Int[(a_+b_.*sin[e_.+f_.*x_])^m_*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -(A*b^2+a^2*C)*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*(m+1)*(a^2-b^2)) + 
  1/(b*(m+1)*(a^2-b^2))*
    Int[(a+b*Sin[e+f*x])^(m+1)*Simp[a*b*(A+C)*(m+1)-(A*b^2+a^2*C+b^2*(A+C)*(m+1))*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,C},x] && LtQ[m,-1] && NeQ[a^2-b^2,0]

6:  ∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  m≮-1

Derivation: Nondegenerate sine recurrence 1b with m->0,p->0

Rule: If  m≮-1, then

∫(((a+b Sin[e+f x]))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  
-((C Cos[e+f x](((a+b Sin[e+f x]))^(m+1)))/(b f (m+2)))+(1/(b (m+2)))∫(((a+b Sin[e+f x]))^m)(A b(m+2)+b C(m+1)+(b B(m+2)-a C)Sin[e+f x])dx

Program code:

Int[(a_.+b_.*sin[e_.+f_.*x_])^m_.*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -C*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*(m+2)) + 
  1/(b*(m+2))*Int[(a+b*Sin[e+f*x])^m*Simp[A*b*(m+2)+b*C*(m+1)+(b*B*(m+2)-a*C)*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,B,C,m},x] && Not[LtQ[m,-1]]

Int[(a_+b_.*sin[e_.+f_.*x_])^m_.*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  -C*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*(m+2)) + 
  1/(b*(m+2))*Int[(a+b*Sin[e+f*x])^m*Simp[A*b*(m+2)+b*C*(m+1)-a*C*Sin[e+f*x],x],x] /;
FreeQ[{a,b,e,f,A,C,m},x] && Not[LtQ[m,-1]]

Rules for integrands of the form (((b ((Sin[e+f x])^p)))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))

1:  ∫(((b ((Sin[e+f x])^p)))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  when  m∉ℤ

Derivation: Piecewise constant extraction

Basis: (∂_x)((((b ((Sin[e+f x])^p)))^m)/(((b Sin[e+f x]))^(m p)))==0

Rule: If  m∉ℤ, then

∫(((b ((Sin[e+f x])^p)))^m)(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx  ⟶  ((((b ((Sin[e+f x])^p)))^m)/(((b Sin[e+f x]))^(m p)))∫(((b Sin[e+f x]))^(m p))(A+B Sin[e+f x]+C ((Sin[e+f x])^2))dx

Program code:

Int[(b_.*sin[e_.+f_.*x_]^p_)^m_*(A_.+B_.*sin[e_.+f_.*x_]+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  (b*Sin[e+f*x]^p)^m/(b*Sin[e+f*x])^(m*p)*Int[(b*Sin[e+f*x])^(m*p)*(A+B*Sin[e+f*x]+C*Sin[e+f*x]^2),x] /;
FreeQ[{b,e,f,A,B,C,m,p},x] && Not[IntegerQ[m]]

Int[(b_.*cos[e_.+f_.*x_]^p_)^m_*(A_.+B_.*cos[e_.+f_.*x_]+C_.*cos[e_.+f_.*x_]^2),x_Symbol] :=
  (b*Cos[e+f*x]^p)^m/(b*Cos[e+f*x])^(m*p)*Int[(b*Cos[e+f*x])^(m*p)*(A+B*Cos[e+f*x]+C*Cos[e+f*x]^2),x] /;
FreeQ[{b,e,f,A,B,C,m,p},x] && Not[IntegerQ[m]]

Int[(b_.*sin[e_.+f_.*x_]^p_)^m_*(A_.+C_.*sin[e_.+f_.*x_]^2),x_Symbol] :=
  (b*Sin[e+f*x]^p)^m/(b*Sin[e+f*x])^(m*p)*Int[(b*Sin[e+f*x])^(m*p)*(A+C*Sin[e+f*x]^2),x] /;
FreeQ[{b,e,f,A,C,m,p},x] && Not[IntegerQ[m]]

Int[(b_.*cos[e_.+f_.*x_]^p_)^m_*(A_.+C_.*cos[e_.+f_.*x_]^2),x_Symbol] :=
  (b*Cos[e+f*x]^p)^m/(b*Cos[e+f*x])^(m*p)*Int[(b*Cos[e+f*x])^(m*p)*(A+C*Cos[e+f*x]^2),x] /;
FreeQ[{b,e,f,A,C,m,p},x] && Not[IntegerQ[m]]